<?php use_helper('Text') ?>
<?php use_helper('Slug') ?>
<div id="share_popup" class="reveal-modal">
		<h3>Partager cet article</h3>
        <ul>
        <li style="margin-top:10px"> Partager cet article sur les réseaux sociaux: </li>
          <li class="inline"> 
            <!-- BUZZ-->  
            <g:plusone size="medium" annotation="inline" width="120"></g:plusone>
          </li>
          <li class="inline"> 
            <!-- TWITER --> 
            <a href="http://twitter.com/share" class="twitter-share-button" data-url="<?php echo public_path(url_for("@show_article_by_id?title=".sluggify($articles["Articles"]["title"])."&idarticles=".$articles["Articles"]["idarticles"]), true) ?>" data-count="horizontal">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> 
          </li>
          <li class="inline"> 
            <!-- FB -->
            <iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo public_path(url_for("@show_article_by_id?title=".sluggify($articles["Articles"]["title"])."&idarticles=".$articles["Articles"]["idarticles"]), true) ?>&amp;layout=button_count&amp;show_faces=false&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe>
          </li>
          <li class="inline" style="width:120px">
          	<script src="http://platform.linkedin.com/in.js" type="text/javascript"></script>
<script type="IN/Share" data-url="<?php echo public_path(url_for("@show_article_by_id?title=".sluggify($articles["Articles"]["title"])."&idarticles=".$articles["Articles"]["idarticles"]), true) ?>" data-counter="right"></script>
          </li>
        <li style="margin-top:10px">Faire un lien sur un site: </li>
        <li>
        	<input name="link" type="text" size="70" value='<?php echo link_to($articles["Articles"]["title"], public_path(url_for("@show_article_by_id?title=".sluggify($articles["Articles"]["title"])."&idarticles=".$articles["Articles"]["idarticles"]), true));?> '/>
        </li>
        <li style="margin-top:10px">Faire un lien sur un forum: </li>
        <li>
        	<input name="link" type="text" size="70" value='[url=<?php echo public_path(url_for("@show_article_by_id?title=".sluggify($articles["Articles"]["title"])."&idarticles=".$articles["Articles"]["idarticles"]), true) ?>]<?php echo $articles["Articles"]["title"] ?>[/url]'/>
        </li>
        
       </ul>
		<a class="close-reveal-modal">&#215;</a>
</div>


<ul style="text-align:right">
  <li style="margin:10px;text-align:right">
  <a class="menu_action" href="<?php echo url_for('@edit_article?id='.$articles["idassoplatform"]); ?>"><?php echo image_tag("Icons/menu_action/edit.png", array("width" => 13,"height" => 13, "alt" => "icon")) ?> Modifier l'article</a> <a class="menu_action" href="<?php echo url_for('@add_version?id='.$articles["Articles"]["idarticles"]); ?>"><?php echo image_tag("Icons/menu_action/new.png", array("width" => 13,"height" => 13, "alt" => "icon")) ?> Ajouter une version</a> <a class="menu_action" href="<?php echo url_for('@viewrevision?id='.$articles["idassoplatform"]); ?>"><?php echo image_tag("Icons/menu_action/information.png", array("width" => 13,"height" => 13, "alt" => "icon")) ?> Consulter les révisions</a>
  <a href="#" class="menu_action" data-reveal-id="share_popup"><?php echo image_tag("Icons/menu_action/recomand.png", array("width" => 13,"height" => 13, "alt" => "icon")) ?> Partager cet article</a>
  </li>
  
  <li class="inline"> <a class="menu_action" href="<?php echo url_for("@view_pdf?id=".$articles["idassoplatform"]) ?>"><?php echo image_tag("Icons/menu_action/telpdf.png", array("width" => 13,"height" => 13, "alt" => "icon")) ?> Télécharger cet article en PDF</a> </li>
  <li class="inline"> | <a class="menu_action" href="<?php echo url_for("@execute_print?id=".$articles["idassoplatform"]) ?>"  title="Imprimer cet article"><?php echo image_tag("Icons/menu_action/printart.png", array("width" => 13,"height" => 13, "alt" => "icon")) ?> Imprimer cet article</a> </li>
  <li class="inline"> | <a class="menu_action" href="<?php echo url_for("favori/new?id=".$articles["Articles"]["idarticles"]."&idasso=".$articles["idassoplatform"]) ?>"  title=""><?php echo image_tag("Icons/menu_action/addfavo.png", array("width" => 13,"height" => 13, "alt" => "icon")) ?> Ajouter cet article à mes favoris</a> </li>
  <li class="inline"> | <a class="menu_action" href="<?php echo url_for("follow/new?idasso=".$articles["idassoplatform"]) ?>"  title=""><?php echo image_tag("Icons/menu_action/follow.png", array("width" => 13,"height" => 13, "alt" => "icon")) ?> Suivre cet article</a> </li>
  <li class="inline"> | <a class="menu_action" href="<?php echo url_for("follow/recomand?idasso=".$articles["idassoplatform"]) ?>" title=""><?php echo image_tag("Icons/menu_action/recomand.png", array("width" => 13,"height" => 13, "alt" => "icon")) ?> Recommander</a> </li>
</ul>
<?php if($sf_context->getConfiguration()->getEnvironment() === 'mod'):?>

<?php if($sf_user->hasCredential("ADD_FLAGS")):?>
<ul>
<li class="inline" style="width:20px">
<?php echo get_component('headers', 'moderation', array('Mtype' => "add", 'MCred' => "ADD_FLAGS", 'MModule' => "flag", 'MAction' => "new", "Mid" => $revision["idrevisions"], "Mid2" => $articles["idassoplatform"])); ?>
</li>
<li class="inline" style="width:350px">
	Ajouter un nouveau flags
</li>
</ul>
<ul>
<?php endif; if($sf_user->hasCredential("SUPPR_REVISION")):?>
<li class="inline" style="width:20px">
<?php echo get_component('headers', 'moderation', array('Mtype' => "delete", 'MCred' => "SUPPR_REVISION", 'MModule' => "article", 'MAction' => "deleterevision", "Mid" => $revision["idrevisions"],"Mid2" => $articles["idassoplatform"])); ?>
</li>
<li class="inline" style="width:350px">
	Revenir à la révision précédente
</li>
</ul>
<ul>
<?php endif; if($sf_user->hasCredential("VAL_VERSION")):?>
<li class="inline" style="width:20px">
<?php echo get_component('headers', 'moderation', array('Mtype' => "online", 'MCred' => "VAL_VERSION", 'MModule' => "revisions", 'MAction' => "validate", "Mid" => $revision["idrevisions"])); ?>
</li>
<li class="inline" style="width:350px">
	Valider cette révision
</li>
</ul>
<ul>
<?php endif; if($sf_user->hasCredential("SUPPR_ARTICLE")):?>
<li class="inline" style="width:20px">
<?php echo get_component('headers', 'moderation', array('Mtype' => "delete", 'MCred' => "SUPPR_ARTICLE", 'MModule' => "article", 'MAction' => "delete", "Mid" => $articles["Articles"]["idarticles"])); ?>
</li>
<li class="inline" style="width:350px">
	Supprimer tout l'article
</li>
</ul>
<ul>
<?php endif; if($sf_user->hasCredential("SUPPR_ARTICLE")):?>
<li class="inline" style="width:20px">
<?php echo get_component('headers', 'moderation', array('Mtype' => "delete", 'MCred' => "SUPPR_ARTICLE", 'MModule' => "article", 'MAction' => "deleteversion", "Mid" => $articles["idassoplatform"],"Mid2" => $articles["Articles"]["idarticles"])); ?>
</li>
<li class="inline" style="width:350px">
	Supprimer cette version de l'article
</li>
</ul>
<?php endif; ?>

<?php endif;?>
<div align="center">
  <?php foreach($revision["Flags"] as $flag):?>
  <div class="flag flag_<?php echo $flag["Defsflags"]["type"] ?>"> <?php echo $flag["Defsflags"]["texte"] ?> 
  <?php if($sf_context->getConfiguration()->getEnvironment() === 'mod'):?>
  <?php echo get_component('headers', 'moderation', array('Mtype' => "delete", 'MCred' => "SUPPR_FLAG", 'MModule' => "flag", 'MAction' => "delete", "Mid" => $flag["idflags"],"Mid2" => $articles["idassoplatform"])); ?>
  <?php endif?>
  </div>
  
  <?php endforeach;?>
</div>
<div class="title_section"> <?php echo $articles["Articles"]["title"] ?> <a class="menu_action" href="<?php echo url_for('@edit_article?id='.$articles["idassoplatform"]); ?>">(Modifier)</a></div>
<div class="section">
	<?php if(count($content_table[1]) != 0): ?>
  	<div class="table_content">
    <span class="title_content_table">Sommaire:</span>
    	<?php 
			for ($i = 0; $i < count($content_table[1]); $i++)
			{
				?>
				<div><a class="tb_<?php echo $content_table[1][$i] ?>" href="#<?php echo htmlspecialchars_decode($content_table[2][$i]) ?>"><?php echo htmlspecialchars_decode($content_table[3][$i]) ?></a></div>
				<?php
			}
		?>
    </div>
    <?php endif;?>
    <?php echo sfOutputEscaper::unescape($texte)?>
    <?php if(count($articles["Articles"]["Articlesreferences"])> 0 || count($articles["Articles"]["Articlessources"])> 0):?>
    <ul class="">
      <?php if(count($articles["Articles"]["Articlessources"])> 0):?>
      <li>Sources:</li>
      <?php foreach($articles["Articles"]["Articlessources"] as $source):?>
      <li><a class="no_underline" href="#<?php echo $source["numero"] ?>"><?php echo $source["numero"] ?></a> : <a class="no_underline" href="<?php echo url_for($source["url"]) ?>" target="_blank"><?php echo $source["texte"] ?></a></li>
      <?php endforeach;?>
      <?php endif;?>
      <?php if(count($articles["Articles"]["Articlesreferences"])> 0):?>
      <li>Voir aussi:</li>
      <?php foreach($articles["Articles"]["Articlesreferences"] as $ref):?>
      <li><span class="detail_info_art"><a class="no_underline" href="#<?php echo $ref["numero"] ?>"><?php echo $ref["numero"] ?></a> : <a class="no_underline" href="<?php echo url_for($ref["url"]) ?>" target="_blank"><?php echo $ref["texte"] ?></a></span></li>
      <?php endforeach;?>
      <?php endif;?>
    </ul>
    <?php endif;?>
    </li>
    <li>
      <div class="title_section"> Details de l'article: </div>
      <div class="section">
        <ul class="">
          <li> Ajouté le: <?php echo date("d-m-Y h:i",strtotime($articles["Articles"]["date_creation"],time())) ?> </li>
          <li> Modifié le: <span class="detail_info_art"><?php echo date("d-m-Y h:i",strtotime($revision["date_creation"],time())) ?></span> </li>
          <li class="inline"> Notez cet article: 
            <!-- NOTE -->
            <div class="jRating" data="<?php if($Moyenne != "-")echo $Moyenne;else echo "0" ?>_<?php echo $articles["idassoplatform"] ?>"></div>
            <Moyenne : <?php echo $Moyenne ?>/20
          </li>
        </ul>
      </div>
    </li>
  </ul>
  <ul style="margin:10px">
    <li style="font-size:16px; margin: 5px;">Les internautes ont aussi visité les articles suivants</li>
    <?php foreach($articles["Articles"]["Relationsarticles"] as $relation):?>
    <li style="margin-left:5px;"> - <a class="list_elem" href="<?php echo url_for('@show_article_by_id?title='.sluggify($relation["Articles_2"]["title"]).'&idarticles='.$relation["Articles_2"]["idarticles"]); ?>"> <?php echo $relation["Articles_2"]["title"] ?> </a> </li>
    <?php endforeach;?>
  </ul>
  <div class="nav_barre"><?php echo get_component('headers', 'pager', array('module' => "article","params" => "idasso=".$articles["idassoplatform"], 'action' => "show", 'pager' => $pager,"optNbTotal" => false,"optImgNextPrev" => false)); ?></div>
  <?php foreach($commentaires as $commentaire):?>
  <div class='coms' style="border:1px solid #CCC; margin:10px; padding:10px">
    <ul style="margin-bottom: 10px">
      <li class="inline" style="width:65%"> Par <?php echo $commentaire["SfGuardUserProfile"]["User"]["username"]?> </li>
      <li class="inline" style="width:30%"> Le <?php echo date("d-m-Y h:i",strtotime($commentaire["date_ajout"],time())) ?> </li>
      <li class="inline"> <?php echo get_component('headers', 'moderation', array('Mtype' => "edit", 'MCred' => "MODERATION_COMS", 'MModule' => "commentaire", 'MAction' => "edit", "Mid" => $commentaire["idcommentaires"])); ?> <?php echo get_component('headers', 'moderation', array('Mtype' => "punir", 'MCred' => "MODERATION_USER", 'MModule' => "advert", 'MAction' => "new", "Mid" => $commentaire->getSfGuardUserProfile()->getUserId())); ?> <?php echo get_component('headers', 'moderation', array('Mtype' => "delete", 'MCred' => "MODERATION_COMS", 'MModule' => "commentaire", 'MAction' => "delete", "Mid" => $commentaire["idcommentaires"])); ?> <?php echo get_component('headers', 'moderation', array('Mtype' => "alert", 'MCred' => "AJOUT_ALERT", 'MModule' => "alert", 'MAction' => "new", "Mid" => $commentaire["idcommentaires"],"Mid2" => $articles["idassoplatform"])); ?> </li>
    </ul>
    <?php echo $commentaire["texte"]?> <span class="block signa"><?php echo sfOutputEscaper::unescape($commentaire["SfGuardUserProfile"]["signature"])?></span> </div>
  <?php endforeach;?>
  <div class="nav_barre"><?php echo get_component('headers', 'pager', array('module' => "article","params" => "title=".sluggify($articles["Articles"]["title"])."&idasso=".$articles["idassoplatform"], 'action' => "show", 'pager' => $pager,"optNbTotal" => false)); ?></div>
  <div>
    <?php if($sf_user->isAuthenticated() && $sf_user->hasCredential("AJOUT_COMS")):?>
    <?php echo get_component('commentaire', 'newcom',array("id" => $articles["idassoplatform"]))?>
    <?php endif;?>
  </div>
</div>

<!-- JS to add -->
<?php echo "
<script>
$(document).ready(function(){ 
   // Call with options - exemple
   $('.jRating').jRating({
     step : false, // no step
     length : 5, // show 10 stars at the init
	 bigStarsPath : '".url_for("/images/Icons/stars.png")."',
	 smallStarsPath: '".url_for("/images/Icons/small.png")."',
	 phpPath: '".url_for("article/jrating")."',  
   });
});

$(document).ready(function() {
     $('#myButton').click(function(e) {
          e.preventDefault();
	  $('#share_popup').reveal();
     });
});

</script>

";
?>